﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace Drawing
{
    public enum TypeShape
    { 
        NONE = 0,
        LINE = 1,
        RECTANGLE = 2,
        CIRCLE = 3
    }

    public enum TypeColor
    { 
        NONE = 0,
        BORDER = 1,
        FILL = 2,
        FOREBACKGROUND = 3,
    }

    public class Shapes
    {
        protected Point m_StartupPosition;
        protected Point m_LastPosition;
        protected TypeShape m_Type;
        protected bool m_IsSelected;
        protected Rectangle m_Rectangle;

        protected Color m_Border_Color;

        protected int m_DeltaX;
        protected int m_DeltaY;

        protected Color m_Color;
        protected TypeColor m_TypeColor;

        //protected bool m_IsFill;
        //protected bool m_IsBorder;

        protected int m_Width;
        protected int m_Height;

        public Color Border_Color
        {
            get { return m_Border_Color; }
            set { m_Border_Color = value; }
        }

        public int Width
        {
            get { return m_Width; }
            set { m_Width = value; }
        }

        public int Height
        {
            get { return m_Height; }
            set { m_Height = value; }
        }

        public int DeltaX
        {
            get { return m_DeltaX; }
            set { m_DeltaX = value; }
        }

        public int DeltaY
        {
            get { return m_DeltaY; }
            set { m_DeltaY = value; }
        }

        public Point StartupPosition
        { 
            get {return m_StartupPosition;}
            set { m_StartupPosition = value; }
        }

        public Point LastPosition
        {
            get { return m_LastPosition; }
            set { m_LastPosition = value; }
        }

        public TypeShape TypeShape
        {
            get { return m_Type; }
            set { m_Type = value;}
        }

        public bool IsSelected
        {
            get { return m_IsSelected; }
            set { m_IsSelected = value; }
        }

        public Rectangle SRectangle
        {
            get { return m_Rectangle; }
            set { m_Rectangle = value; }
        }

        public Color SColor
        {
            get { return m_Color; }
            set { m_Color = value; }
        }

        public TypeColor TColor
        {
            get { return m_TypeColor; }
            set { m_TypeColor = value; }
        }

        public Shapes(Point _StartupPosition, Point _LastPosition)
        {
            m_StartupPosition = _StartupPosition;
            m_LastPosition = _LastPosition;
            m_IsSelected = false;
            m_Color = Color.Black;
            m_TypeColor = TypeColor.BORDER;
            m_Border_Color = Color.Black;
        }

        public Shapes(Point _StartupPosition)
        {
            m_StartupPosition = _StartupPosition;
            m_Color = Color.Black;
        }

        public virtual Rectangle GetRectangle()
        {
            return new Rectangle(new Point(0, 0), new Size(0, 0));
        }

        public virtual bool IsContain(Point _PointOfPointer)
        {
            if (GetRectangle().Contains(_PointOfPointer) == true)
                m_IsSelected = true;
            else
                m_IsSelected = false;
            return m_IsSelected;
        }

        public virtual float GetSupperficies()
        {
            return 0;
        }
    }
}
